extends Node
func _ready():
	pass
func _init():
	call_deferred("init")
func _connect():
	pass
var utils = null
func init():
	utils = globalData.infoDs["g_azurlaneUtils"]

var skills = {1: Skill_001, 2: Skill_002, 3: Skill_003, 4: Skill_004, 5: Skill_005, 6: Skill_006, 7: Skill_007, 8: Skill_008, 9: Skill_009,
10: Skill_010, 11: Skill_011, 12: Skill_012, 13: Skill_013, 14: Skill_014, 15: Skill_015, 16: Skill_016, 17: Skill_017, 18: Skill_018, 19: Skill_019,
20: Skill_020, 21: Skill_021, 22: Skill_022, 23: Skill_023, 24: Skill_024, 25: Skill_025, 26: Skill_026, 27: Skill_027, 28: Skill_028, 29: Skill_029,
30: Skill_030, 31: Skill_031, 32: Skill_032, 33: Skill_033, 34: Skill_034, 35: Skill_035, 36: Skill_036, 37: Skill_037, 38: Skill_038, 39: Skill_039,
40: Skill_040, 41: Skill_041, 42: Skill_042, 43: Skill_043, 44: Skill_044, 45: Skill_045, 46: Skill_046, 47: Skill_047, 48: Skill_048, 49: Skill_049,
50: Skill_050, 51: Skill_051, 52: Skill_052, 53: Skill_053, 54: Skill_054, 55: Skill_055, 56: Skill_056, 57: Skill_057, 58: Skill_058, 59: Skill_059,
60: Skill_060, 61: Skill_061}

var skillsOthers = []
var skillsAd = []
var skillsAp = []
var skillsAir = []
var skillsT = []

func getRndSkill(prefer):
	if skillsAd.empty():
		sortSkills()

	match prefer:
		"t":
			if sys.rndPer(35):
				return sys.rndListItem(skillsOthers)
			else:
				return sys.rndListItem(skillsT)
		"all":return sys.rndListItem(skillsOthers)
		"air":
			if sys.rndPer(35):
				return sys.rndListItem(skillsOthers)
			else:
				return sys.rndListItem(skillsAir)
		"ad":
			if sys.rndPer(35):
				return sys.rndListItem(skillsOthers)
			else:
				return sys.rndListItem(skillsAd)
		"ap":
			if sys.rndPer(35):
				return sys.rndListItem(skillsOthers)
			else:
				return sys.rndListItem(skillsAp)


#获得指定技能
func getSkill(id:int):
	return skills.get(id).new()

func sortSkills():
	for i in skills.keys():
		var cls = skills.get(i)
		var sk = cls.new()
		match sk.type:
			"ad":skillsAd.append(cls)
			"ap":
				skillsAp.append(cls)
				skillsAir.append(cls)
			"all":skillsOthers.append(cls)
			"dps":
				skillsAd.append(cls)
				skillsAp.append(cls)
				skillsAir.append(cls)
			"air":
				skillsAir.append(cls)
			"t":
				skillsT.append(cls)

class Skill extends Object:
	var text
	var tcha:Chara
	var sid:int
	var sname
	var type
	var utils = globalData.infoDs["g_azurlaneUtils"]
	var buff = globalData.infoDs["g_azurlaneBuffs"]
	var azurCtrl = globalData.infoDs["g_azurlane"]
	var cdId
	#不能学习此技能的角色ID
	var excludeChas = []
	#connect记录
	var cons = []
	var exPlane = false
	#是否允许AI拥有
	var enableAi = true
	var item
	func makeConnect(origin, object, target):
		object.connect(origin, self, target)
		cons.append({"origin":origin,"target":target, "object":object})
		if origin == "onBattleStart" || origin == "onBattleEnd":
			exPlane = true
	func _init():
		pass
	func setCha(cha):
		tcha = cha
	func remove():
		for i in cons:
			i.object.disconnect(i.origin, self, i.target)
		cons.clear()
		if cdId != null:
			for i in tcha.skills:
				if i.id == cdId:
					tcha.skills.erase(i)
					break
		tcha = null	
	func toJson():
		return {"sid":sid}
	func setItem(item):
		self.item = item

#----------------------------------------------001战士血统----------------------------------------------
class Skill_001 extends Skill:
	#稀有度因子
	func _init():
		._init()
		enableAi = false
		text = "战斗开始时，获得[血上限*4%]的炮击"
		sname = "战士血统"
		sid = 1
		type = "ad"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleStart", tcha, "onBattleStart")
		if cha.isSumm:
			onBattleStart()
	func onBattleStart():
		if utils.inBattle(tcha):
			tcha.addBuff(b_sk_atk.new())
	class b_sk_atk:
		extends "../azurlane_ctrl/AzurBuff.gd"
		func _init():
			attInit()
			buffName = "战士血统"
			id = "b_sk_atk"	
			dispel = 2
		func _connect():
			att.atk = masCha.att.maxHp*0.04	
#----------------------------------------------002高速机动----------------------------------------------				
class Skill_002 extends Skill:
	func _init():
		._init()
		text = "机动+40"
		sname = "高速机动"
		sid = 2
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleStart", tcha, "onBattleStart")
		if cha.isSumm:
			onBattleStart() 
	func onBattleStart():
		if utils.inBattle(tcha):
			tcha.addBuff(buff.b_dod.new(40))
#----------------------------------------------003狩猎标记----------------------------------------------
class Skill_003 extends Skill:
	func _init():
		._init()
		excludeChas = ["shentong", "changmen"]
		text = "造成炮击伤害时获得2层<炮术>，并赋予目标1层<流血><烧蚀>"
		sname = "狩猎标记"
		sid = 3
		type = "ad"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onAtkChara", tcha, "onAtkChara")
	func onAtkChara(atkInfo):
		if atkInfo.atkType == sys.AtkType.GUN:
			tcha.addBuff(buff.b_paoShu.new(2))
			tcha.castBuff(atkInfo.hitCha, buff.b_liuXueR.new(1))
			tcha.castBuff(atkInfo.hitCha, buff.b_shaoShi.new(1))
#----------------------------------------------004强攻----------------------------------------------
class Skill_004 extends Skill:
	func _init():
		._init()
		text = "战斗开始时，若自身炮击大于雷击，则提高60点炮击，反之则提高60点雷击"
		sname = "强攻"
		sid = 4
		type = "dps"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleStart", tcha, "onBattleStart")
		if cha.isSumm:
			onBattleStart() 
	func onBattleStart():
		if utils.inBattle(tcha):
			tcha.addBuff(b_sk_004.new())
	class b_sk_004:
		extends "../azurlane_ctrl/AzurBuff.gd"
		func _init():
			attInit()
			buffName = "强攻"
			id = "b_sk_004"	
			dispel = 2
		func _connect():
			if masCha.att.atk > masCha.att.mgiAtk:
				att.atk = 60
			else:
				att.mgiAtk = 60
#----------------------------------------------005小队领袖----------------------------------------------
class Skill_005 extends Skill:
	func _init():
		._init()
		text = "炮击30%概率为周围1格(九宫格)的友军(除自己)附加2层活力"
		sname = "小队领袖"
		sid = 5
		type = "ad"
	func setCha(cha):
		.setCha(cha)
		makeConnect("normalAtkChara", tcha, "normalAtkChara")
	func normalAtkChara(cha):
		if sys.rndPer(30):
			for i in tcha.getAroundChas(tcha.cell, true):
				if i != tcha:
					buff.addHuoLi(i, tcha, 2)
#----------------------------------------------006防御指令----------------------------------------------
class Skill_006 extends Skill:
	func _init():
		._init()
		text = "每当使用技能时，赋予[最靠前]的三名队友2层<灵动><坚守>"
		sname = "防御指令"
		sid = 6
		type = "ap"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
	func castCdSkill(id):
		var chas = tcha.getAllChas(2)
		chas.sort_custom(tcha, "sortByFront")
		for i in range(3):
			if i >= chas.size():break
			tcha.castBuff(chas[i], buff.b_lingDong.new(2))
			tcha.castBuff(chas[i], buff.b_jianShou.new(2))

#----------------------------------------------007装甲强化----------------------------------------------
class Skill_007 extends Skill:
	func _init():
		._init()
		text = "战斗开始时，提高60点装甲"
		sname = "装甲强化"
		sid = 7
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleStart", tcha, "onBattleStart")
		if cha.isSumm:
			onBattleStart() 
	func onBattleStart():
		if utils.inBattle(tcha):
			tcha.addBuff(buff.b_def.new(60))
#----------------------------------------------008前锋支援----------------------------------------------
class Skill_008 extends Skill:
	func _init():
		._init()
		text = "每当使用技能时，恢复[最靠前]的三名队友5层[三攻*20%]的生命值"
		sname = "前锋支援"
		sid = 8
		type = "ap"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
	func castCdSkill(id):
		var chas = tcha.getAllChas(2)
		chas.sort_custom(tcha,"sortByFront")
		var dmg = (tcha.att.mgiAtk + tcha.att.atk + tcha.att.air) * 0.2
		for i in range(3):
			if i >= chas.size():break
			tcha.healCha(chas[i], dmg)
#----------------------------------------------009消防特训----------------------------------------------
class Skill_009 extends Skill:
	func _init():
		._init()
		text = "受到的特效伤害降低60%"
		sname = "消防特训"
		sid = 9
		type = "t"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onHurt", tcha, "onHurt")
	func onHurt(atkInfo):
		if atkInfo.atkType == sys.AtkType.EFF:
			atkInfo.hurtVal *= 0.4
#----------------------------------------------010神隐----------------------------------------------
class Skill_010 extends Skill:
	func _init():
		._init()
		text = "<固化>每10秒使全体友军<无敌>1秒"
		sname = "神隐"
		sid = 10
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("upS", tcha, "upS")
		makeConnect("onBattleStart", tcha, "onBattleStart")
	var flag = 0
	func upS():
		flag += 1
		if flag >= 10:
			var chas = tcha.getAllChas(2)
			for i in chas:
				if not i.hasBuff("b_wudi"):
					i.addBuff(buff.b_wudi.new(1))
			flag = 0
	func onBattleStart():
		flag = 0
#----------------------------------------------011恶作剧----------------------------------------------
class Skill_011 extends Skill:
	func _init():
		._init()
		text = "每10秒对一条直线上的敌人造成[(雷击+航空)*2]的技能伤害，并使其眩晕1秒"
		sname = "恶作剧"
		sid = 11
		type = "ap"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("sk011", 10)
		cdId = "sk011"
	func castCdSkill(id):
		if id == "sk011":
			var eff:Eff = tcha.newEff("sk_feiZhan",tcha.sprcPos)
			eff._initFlyPos(tcha.position + (tcha.aiCha.position - tcha.position).normalized() * 800, 800)
			eff.connect("onInCell",self,"effInCell")
	func effInCell(cell):
		var cha = tcha.matCha(cell)
		if cha == null:
			cha = tcha.matCha(cell + Vector2(0, 1))
		if cha != null and cha.team != tcha.team:
			tcha.azurHurtChara(cha, (tcha.att.mgiAtk + tcha.att.air) * 2, sys.HurtType.WEAPON, sys.AtkType.SKILL, "恶作剧")
			var bf = cha.hasBuff("b_xuanYun")
			if bf == null:
				cha.addBuff(buff.b_xuanYun.new(1))
			else:
				bf.life += 0.2

#----------------------------------------------012强化防御----------------------------------------------
class Skill_012 extends Skill:
	func _init():
		._init()
		excludeChas = ["junzhu", "nandaketa"]
		text = "开局获得10层<坚守>，受到攻击时获得2层<坚守>，被治疗效果提高30%"
		sname = "强化防御"
		sid = 12
		type = "t"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleStart", tcha, "onBattleStart")
		if cha.isSumm:
			onBattleStart() 
		makeConnect("onHurt", tcha, "onHurt")
	func onBattleStart():
		if utils.inBattle(tcha):
			tcha.addBuff(buff.b_jianShou.new(10))
			tcha.addBuff(buff.b_reHp.new(3))
	func onHurt(atkInfo):
		tcha.addBuff(buff.b_jianShou.new(2))
#----------------------------------------------013反击之誓约----------------------------------------------
class Skill_013 extends Skill:
	func _init():
		._init()
		text = "每8秒，将所受的所有伤害的100%施加给当前目标，并清空累计值"
		sname = "反击之誓约"
		sid = 13
		type = "t"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		makeConnect("onHurt", tcha, "onHurt")
		makeConnect("onBattleStart", tcha, "onBattleStart")
		tcha.addCdSkill("sk013", 8)
		cdId = "sk013"
	var hurtNum = 0
	func castCdSkill(id):
		if id == "sk013" and tcha.aiCha != null and hurtNum > 0:
			tcha.azurHurtChara(tcha.aiCha, hurtNum*1, sys.HurtType.WEAPON, sys.AtkType.SKILL, "反击之誓约")
			hurtNum = 0
	func onHurt(atkInfo):
		if not atkInfo.isMiss and atkInfo.hurtVal > 0 and not atkInfo.virtual:
			hurtNum += atkInfo.hurtVal
	func onBattleStart():
		hurtNum = 0
#----------------------------------------------014致命诱饵----------------------------------------------
class Skill_014 extends Skill:
	func _init():
		._init()
		text = "战斗开始时，牺牲自己，将对称的敌人拉到自己位置，使所有射程大于2的友军集火她，赋予其3层<暴露><放逐>"
		sname = "致命诱饵"
		sid = 14
		type = "all"
	var suckCha = []
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleStart", tcha, "onBattleStart")
	func onBattleStart():
		var cell = tcha.cell
		var cha = sys.main.matCha(Vector2(9 - cell.x, cell.y))
		if cha != null and cha.team != tcha.team:
			tcha.forceKillCha(tcha)
			cha.setCell(cell)
			buff.addBaoLu(cha, 3)
			cha.addBuff(buff.b_fangZhu.new(3))
			for i in tcha.getAllChas(2):
				if i.att.atkRan > 2 or tcha.cellRan(cell, i.cell) < 2:
					i.aiCha = cha

#----------------------------------------------015威光----------------------------------------------
class Skill_015 extends Skill:
	func _init():
		._init()
		excludeChas = ["gaoxiong"]
		text = "炮击暴击后有75%的概率获得1层<圣盾>"
		sname = "威光"
		sid = 15
		type = "ad"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onAtkChara", tcha, "onAtkChara")
	func onAtkChara(atkInfo):
		if atkInfo.atkType == sys.AtkType.GUN and atkInfo.isCri and sys.rndPer(75):
			buff.addShengDun(tcha, 1)
#----------------------------------------------016上游导弹----------------------------------------------
class Skill_016 extends Skill:
	func _init():
		._init()
		text = "每10秒发射一枚恐怖的上游导弹，对目标及2格范围内的敌方单位造成[双攻*1]的技能伤害"
		sname = "上游导弹"
		sid = 16
		type = "dps"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("sk016", 10)
		cdId = "sk016"
	func castCdSkill(id):
		if id == "sk016":
			var eff:Eff = tcha.newEff("sk_yunShi")
			eff.position = tcha.aiCha.position
			var chas = tcha.getCellChas(tcha.aiCha.cell,2,1)
			yield(tcha.reTimer(0.45), "timeout")
			for i in chas:
				tcha.azurHurtChara(i, tcha.att.mgiAtk+tcha.att.atk, sys.HurtType.WEAPON, sys.AtkType.SKILL, "上游导弹")
#----------------------------------------------017被迫营业----------------------------------------------
class Skill_017 extends Skill:
	func _init():
		._init()
		text = "战斗结束时获得8金币"
		sname = "被迫营业"
		sid = 17
		type = "all"
		enableAi = false
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleEnd", tcha, "onBattleEnd")
	func onBattleEnd():
		if tcha.team == 1 and utils.inBattle(tcha):
			sys.main.player.plusGold(8)
#----------------------------------------------018意外赠礼----------------------------------------------
class Skill_018 extends Skill:
	func _init():
		._init()
		text = "造成技能伤害时，50%概率追加2层<漏水>效果"
		sname = "意外赠礼"
		sid = 18
		type = "dps"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onAtkChara", tcha, "onAtkChara")
	func onAtkChara(atkInfo):
		if atkInfo.atkType == sys.AtkType.SKILL and sys.rndPer(50):
			buff.addLouShui(atkInfo.hitCha, tcha, 2)
#----------------------------------------------019自我维修----------------------------------------------
class Skill_019 extends Skill:
	func _init():
		._init()
		text = "每6秒恢复18%生命值"
		sname = "自我维修"
		sid = 19
		type = "t"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("sk019", 6)
		cdId = "sk019"
	func castCdSkill(id):
		if id == "sk019":
			tcha.healCha(tcha, tcha.att.maxHp*0.18)
#----------------------------------------------020速攻----------------------------------------------
class Skill_020 extends Skill:
	func _init():
		._init()
		text = "战斗开始时，射速提高30%"
		sname = "速攻"
		sid = 20
		type = "dps"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleStart", tcha, "onBattleStart")
		if cha.isSumm:
			onBattleStart() 
	func onBattleStart():
		if utils.inBattle(tcha):
			tcha.addBuff(buff.b_spd.new(3))
#----------------------------------------------021月蚀----------------------------------------------
class Skill_021 extends Skill:
	func _init():
		._init()
		text = "每8秒发动：每秒降下一道月光，对周围2格的随机一名敌人造成[双攻*0.5]的技能伤害，持续4秒"
		sname = "月蚀"
		sid = 21
		type = "dps"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("sk021", 8)
		cdId = "sk021"
	func castCdSkill(id):
		if id == "sk021":
			cast()
	func cast():
			tcha.addBuff(b_yueShi.new(4))
	class b_yueShi:
		extends "../azurlane_ctrl/AzurBuff.gd"
		var tcha
		func _init(lv = 1):
			attInit()
			life = lv
			id = "b_yueShi"
			buffName = "月蚀"
		#周围一格
		var aroundCells = [Vector2(-1,0),Vector2(1,0),Vector2(0,1),Vector2(0,-1),Vector2(1,1),Vector2(-1,-1),Vector2(1,-1),Vector2(-1,1)]
		func _upS():
			var chas = masCha.getCellChas(masCha.cell, 2, 1)
			if chas.empty():return
			chas.shuffle()
			var d1:Eff = sys.newEff("animEff", chas[0].position)
			d1.setImgs(sys.getBasePath() + "/eff/starDown", 15, false)
			d1.scale *= 1.8
			d1.normalSpr.position=Vector2(0, -20)
			masCha.azurHurtChara(chas[0], (masCha.att.mgiAtk + masCha.att.atk)*0.5, sys.HurtType.WEAPON, sys.AtkType.SKILL, "月蚀")
#----------------------------------------------022赏金猎人----------------------------------------------
class Skill_022 extends Skill:
	func _init():
		._init()
		text = "击杀敌人时，获得[该敌人等级*1]的金币"
		sname = "赏金猎人"
		sid = 22
		type = "dps"
		enableAi = false
	func setCha(cha):
		.setCha(cha)
		makeConnect("onKillChara", tcha, "onKillChara")
	func onKillChara(atkInfo):
		sys.main.player.plusGold(atkInfo.hitCha.lv*1)
#----------------------------------------------023牺牲精神----------------------------------------------
class Skill_023 extends Skill:
	func _init():
		._init()
		text = "死亡时，赋予全体友军5秒[激愤](双攻提高35%)"
		sname = "牺牲精神"
		sid = 23
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onDeath", tcha, "onDeath")
	func onDeath(atkInfo):
		for i in tcha.getAllChas(2):
			i.addBuff(b_jiFen.new(5))
	class b_jiFen:
		extends "../azurlane_ctrl/AzurBuff.gd"
		func _init(lv = 1):
			attInit()
			buffName = "激愤"
			life = lv
			id = "b_jiFen"
			att.atkL = 0.35
			att.mgiAtkL = 0.35
#----------------------------------------------024巩固后方----------------------------------------------
class Skill_024 extends Skill:
	func _init():
		._init()
		text = "<固化>每8秒赋予[最靠后]的3名友军1层<圣盾>"
		sname = "巩固后方"
		sid = 24
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("upS", tcha, "upS")
		makeConnect("onBattleStart", tcha, "onBattleStart")
	var flag = 0
	func upS():
		flag += 1
		if flag >= 8:
			var chas = tcha.getAllChas(2)
			chas.sort_custom(tcha, "sortByFrontDesc")
			for i in range(3):
				if i >= chas.size():break
				buff.addShengDun(chas[i], 1)
			flag = 0
	func onBattleStart():
		flag = 0
#----------------------------------------------025连续射击----------------------------------------------
class Skill_025 extends Skill:
	func _init():
		._init()
		excludeChas = ["liyijiushi", "weiqita", "zhala"]
		text = "每次炮击有22%概率追加一次炮击"
		sname = "连续射击"
		sid = 25
		type = "ad"
	func setCha(cha):
		.setCha(cha)
		makeConnect("normalAtkChara", tcha, "normalAtkChara")
	func normalAtkChara(cha):
		if sys.rndPer(22):
			tcha.normalAtk(cha)
#----------------------------------------------026弹药后效----------------------------------------------
class Skill_026 extends Skill:
	#稀有度因子
	func _init():
		._init()
		text = "每次造成非特效伤害赋予敌方单位2层随机负面效果"
		sname = "弹药后效"
		sid = 26
		type = "dps"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onAtkChara", tcha, "onAtkChara")
	func onAtkChara(atkInfo):
		if not atkInfo.hitCha.isDeath:
			buff.addRndDebuff(tcha, atkInfo.hitCha, 2)
#----------------------------------------------027水线打击----------------------------------------------
class Skill_027 extends Skill:
	func _init():
		._init()
		text = "炮击赋予目标1层<漏水>"
		sname = "水线打击"
		sid = 27
		type = "ad"
	func setCha(cha):
		.setCha(cha)
		makeConnect("normalAtkChara", tcha, "normalAtkChara")
	func normalAtkChara(cha):
		buff.addLouShui(cha, tcha, 1)
#----------------------------------------------028狂暴----------------------------------------------
class Skill_028 extends Skill:
	func _init():
		._init()
		text = "战斗开始时，提高25%暴击"
		sname = "狂暴"
		sid = 28
		type = "ad"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleStart", tcha, "onBattleStart")
		if cha.isSumm:
			onBattleStart() 
	func onBattleStart():
		if utils.inBattle(tcha):
			tcha.addBuff(buff.b_cri.new(2.5))
#----------------------------------------------029快速冷却----------------------------------------------
class Skill_029 extends Skill:
	func _init():
		._init()
		text = "战斗开始时，提高20%冷却速度"
		sname = "快速冷却"
		sid = 29
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleStart", tcha, "onBattleStart")
		if cha.isSumm:
			onBattleStart() 
	func onBattleStart():
		if utils.inBattle(tcha):
			tcha.addBuff(buff.b_cd.new(2))
#----------------------------------------------030预装填----------------------------------------------
class Skill_030 extends Skill:
	func _init():
		._init()
		text = "战斗开始时，使自身技能完成一半的冷却"
		sname = "快速冷却"
		sid = 30
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleStart", tcha, "onBattleStart")
		if cha.isSumm:
			onBattleStart() 
	func onBattleStart():
		if utils.inBattle(tcha):
			for sk in tcha.skills:
				sk.nowTime = sk.cd*0.5
#----------------------------------------------031火海----------------------------------------------
class Skill_031 extends Skill:
	func _init():
		._init()
		text = "每8秒赋予所有敌人2层<烧蚀>"
		sname = "火海"
		sid = 31
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("sk031", 8)
		cdId = "sk031"
	func castCdSkill(id):
		if id == "sk031":
			for i in tcha.getAllChas(1):
				i.addBuff(buff.b_shaoShi.new(2))
#----------------------------------------------032冰火领域----------------------------------------------
class Skill_032 extends Skill:
	func _init():
		._init()
		text = "每秒对周围(九宫格范围)敌人造成[目标血上限*3%]的技能伤害，并附加3层<烧蚀><霜冻>"
		sname = "冰火领域"
		sid = 32
		type = "t"
	func setCha(cha):
		.setCha(cha)
		makeConnect("upS", tcha, "upS")
	func upS():
		for i in tcha.getAroundChas(tcha.cell, false):
			var p = 0.03
			if i.type == sys.CharaClass.BOSS:p = 0.01
			tcha.azurHurtChara(i, i.att.maxHp * p, sys.HurtType.WEAPON, sys.AtkType.SKILL, "冰火领域")
			i.addBuff(buff.b_shaoShi.new(3))
			i.addBuff(buff.b_shuangDong.new(3))
#----------------------------------------------033元气弹----------------------------------------------
class Skill_033 extends Skill:
	func _init():
		._init()
		text = "每12秒对当前目标直线上的所有单位造成[四维之和*1]的技能伤害"
		sname = "元气弹"
		sid = 33
		type = "dps"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("sk033", 12)
		cdId = "sk033"
	func castCdSkill(id):
		if id == "sk033":
			var eff:Eff = tcha.newEff("sk_feiZhan",tcha.sprcPos)
			eff._initFlyPos(tcha.position + (tcha.aiCha.position - tcha.position).normalized() * 800, 800)
			eff.connect("onInCell",self,"effInCell")
	func effInCell(cell):
		var cha = tcha.matCha(cell)
		if cha == null:
			cha = tcha.matCha(cell + Vector2(0, 1))
		if cha != null and cha.team != tcha.team:
			tcha.azurHurtChara(cha, (tcha.att.mgiAtk+tcha.att.atk+tcha.att.def+tcha.att.air) * 1, sys.HurtType.WEAPON, sys.AtkType.SKILL, "元气弹")
#----------------------------------------------034灵魂灼烧----------------------------------------------
class Skill_034 extends Skill:
	func _init():
		._init()
		text = "每10秒对所有具有<烧蚀>的敌人造成[(三攻中最高的一个)*烧蚀层数*10%]的技能伤害"
		sname = "灵魂灼烧"
		sid = 34
		type = "dps"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("sk034", 10)
		cdId = "sk034"
	func castCdSkill(id):
		if id == "sk034":
			var baseDmg = max(tcha.att.atk, tcha.att.mgiAtk)
			baseDmg = max(baseDmg, tcha.att.air)
			for i in tcha.getAllChas(1):
				for j in i.buffs:
					if j.id == "b_shaoShi":
						tcha.azurHurtChara(i, baseDmg*0.1*j.life, sys.HurtType.WEAPON, sys.AtkType.SKILL, "灵魂灼烧")

#----------------------------------------------035全方位防御----------------------------------------------
class Skill_035 extends Skill:
	func _init():
		._init()
		text = "受到伤害时，30%概率获得1层<圣盾>"
		sname = "全方位防御"
		sid = 35
		type = "t"
		excludeChas = ["luoen"]
	func setCha(cha):
		.setCha(cha)
		makeConnect("onHurt", tcha, "onHurt")
	func onHurt(atkInfo):
		if sys.rndPer(30):
			buff.addShengDun(tcha, 1)
#----------------------------------------------036舰队荣耀----------------------------------------------
class Skill_036 extends Skill:
	func _init():
		._init()
		text = "每8秒赋予全体友军3层<速攻>"
		sname = "舰队荣耀"
		sid = 36
		type = "all"
		excludeChas = ["yilishabai", "hude"]
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("sk036", 8)
		cdId = "sk036"
	func castCdSkill(id):
		if id == "sk036":
			for i in tcha.getAllChas(2):
				if not i.isDeath:
					i.addBuff(buff.b_suGong.new(3))
#----------------------------------------------037那不勒斯之光----------------------------------------------
class Skill_037 extends Skill:
	func _init():
		._init()
		text = "受到炮击伤害时，30%概率使攻击者<眩晕>2秒"
		sname = "那不勒斯之光"
		sid = 37
		type = "t"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onHurt", tcha, "onHurt")
	func onHurt(atkInfo:AtkInfo):
		if atkInfo.atkType == sys.AtkType.GUN and sys.rndPer(30):
			atkInfo.atkCha.addBuff(buff.b_xuanYun.new(2))
#----------------------------------------------038同赴国难----------------------------------------------
class Skill_038 extends Skill:
	func _init():
		._init()
		text = "死亡时为全体敌方单位附加5层<流血><烧蚀>"
		sname = "同赴国难"
		sid = 38
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onDeath", tcha, "onDeath")
	func onDeath(atkInfo):
		for i in tcha.getAllChas(1):
			i.addBuff(buff.b_liuXueR.new(5))
			i.addBuff(buff.b_shaoShi.new(5))
#----------------------------------------------039酸素鱼雷----------------------------------------------
class Skill_039 extends Skill:
	func _init():
		._init()
		text = "雷击伤害暴击时，额外附带10层<灼烧>"
		sname = "酸素鱼雷"
		sid = 39
		type = "ap"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onAtkChara", tcha, "onAtkChara")
	func onAtkChara(atkInfo):
		if atkInfo.atkType == sys.AtkType.TORPEDO and atkInfo.isCri:
			tcha.castBuff(atkInfo.hitCha, buff.b_zhuoShao.new(10))
#----------------------------------------------040弹链模式----------------------------------------------
class Skill_040 extends Skill:
	func _init():
		._init()
		text = "战斗开始后，每秒提高2%射速，上限100%"
		sname = "弹链模式"
		sid = 40
		type = "dps"
	func setCha(cha):
		.setCha(cha)
		makeConnect("upS", tcha, "upS")
	func upS():
		var bf = tcha.hasBuff("b_sk040")
		if bf == null:
			tcha.addBuff(b_sk040.new())
		elif bf.att.spd < 1:
			bf.att.spd += 0.02
	class b_sk040:
		extends "../azurlane_ctrl/AzurBuff.gd"
		func _init():
			attInit()
			id = "b_sk040"	
			dispel = 2
#----------------------------------------------041强化雷击----------------------------------------------
class Skill_041 extends Skill:
	func _init():
		._init()
		text = "战斗开始后，每秒提高1%雷击，上限50%"
		sname = "强化雷击"
		sid = 41
		type = "ap"
	func setCha(cha):
		.setCha(cha)
		makeConnect("upS", tcha, "upS")
	func upS():
		var bf = tcha.hasBuff("b_sk040")
		if bf == null:
			tcha.addBuff(b_sk040.new())
		elif bf.att.mgiAtkL < 1:
			bf.att.mgiAtkL += 0.02
	class b_sk040:
		extends "../azurlane_ctrl/AzurBuff.gd"
		func _init():
			attInit()
			id = "b_sk040"	
			dispel = 2
#----------------------------------------------042先手----------------------------------------------
class Skill_042 extends Skill:
	func _init():
		._init()
		text = "战斗开始时，立即召唤一次舰载机"
		sname = "先手"
		sid = 41
		type = "air"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleStart", tcha, "onBattleStart")
	func onBattleStart():
		if utils.inBattle(tcha) and tcha.has_method("castPlane"):
			tcha.castPlane()
#----------------------------------------------043强化航空----------------------------------------------
class Skill_043 extends Skill:
	func _init():
		._init()
		text = "战斗开始后，每秒提高1%航空，上限50%"
		sname = "强化航空"
		sid = 43
		type = "air"
	func setCha(cha):
		.setCha(cha)
		makeConnect("upS", tcha, "upS")
	func upS():
		var bf = tcha.hasBuff("b_sk040")
		if bf == null:
			tcha.addBuff(b_sk040.new())
		elif bf.att.airL < 1:
			bf.att.airL += 0.02
	class b_sk040:
		extends "../azurlane_ctrl/AzurBuff.gd"
		func _init():
			attInit()
			id = "b_sk040"	
			dispel = 2
#----------------------------------------------044剧毒炸弹----------------------------------------------
class Skill_044 extends Skill:
	func _init():
		._init()
		text = "每8秒赋予目标及其周围(九宫格)的敌人5层<剧毒>"
		sname = "剧毒炸弹"
		sid = 44
		type = "dps"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("sk044", 8)
		cdId = "sk044"
	func castCdSkill(id):
		if id == "sk044":
			for i in tcha.getAroundChas(tcha.aiCha.cell, false, tcha.aiCha):
				buff.addJuDu(tcha.aiCha, tcha, 5)
#----------------------------------------------045高能电池----------------------------------------------
class Skill_045 extends Skill:
	func _init():
		._init()
		text = "受到治疗时，额外获得50%治疗量的护盾"
		sname = "高能电池"
		sid = 45
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onPlusHp", tcha, "onPlusHp")
	func onPlusHp(val):
		if val > 0:
			tcha.changeShield(val*0.5)
#----------------------------------------------046反射力量----------------------------------------------
class Skill_046 extends Skill:
	func _init():
		._init()
		text = "反弹35%所受非特效伤害"
		sname = "反射力量"
		sid = 46
		type = "t"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onHurt", tcha, "onHurt")
	func onHurt(atkInfo:AtkInfo):
		if atkInfo.atkType != sys.AtkType.EFF:
			atkInfo.fanShang += 0.35
#----------------------------------------------047超重起飞----------------------------------------------
class Skill_047 extends Skill:
	func _init():
		._init()
		text = "自己召唤舰载机后，赋予其10层<振奋>"
		sname = "超重起飞"
		sid = 47
		type = "air"
	func setCha(cha):
		.setCha(cha)
		makeConnect("summChara", tcha, "summChara")
	func summChara(cha):
		if cha.has_method("duliSk3"):
			tcha.castBuff(cha, buff.b_zhenFen.new(10))
#----------------------------------------------048空袭指令----------------------------------------------
class Skill_048 extends Skill:
	func _init():
		._init()
		text = "每8秒使场上的舰载机获得5层<活力><速攻>"
		sname = "空袭指令"
		sid = 48
		type = "air"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("sk048", 8)
		cdId = "sk048"
	func castCdSkill(id):
		if id == "sk048":
			for i in tcha.getAllChas(2):
				if i.has_method("duliSk3"):
					buff.addHuoLi(i, tcha, 5)
					i.addBuff(buff.b_suGong.new(5))
#----------------------------------------------049活力四射----------------------------------------------
class Skill_049 extends Skill:
	func _init():
		._init()
		text = "每10秒赋予全体友军2层<活力>"
		sname = "活力四射"
		sid = 49
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("sk049", 10)
		cdId = "sk049"
	func castCdSkill(id):	
		if id == "sk049":
			for i in tcha.getAllChas(2):
				buff.addHuoLi(i, tcha, 2)
#----------------------------------------------050三连射----------------------------------------------
class Skill_050 extends Skill:
	func _init():
		._init()
		text = "每10秒对当前目标连续发动3次炮击"
		sname = "三连射"
		sid = 50
		type = "ad"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("sk050", 10)
		cdId = "sk050"
	func castCdSkill(id):	
		if id == "sk050":
			for i in range(3):
				yield(tcha.reTimer(0.1), "timeout")
				if tcha.aiCha == null:
					yield(tcha.reTimer(0.05), "timeout")
				tcha.normalAtkChara(tcha.aiCha)
#----------------------------------------------051双联雷击----------------------------------------------
class Skill_051 extends Skill:
	func _init():
		._init()
		text = "每12秒对当前目标连续发动2次雷击"
		sname = "双联雷击"
		sid = 51
		type = "ap"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("sk051", 10)
		cdId = "sk051"
	func castCdSkill(id):	
		if id == "sk051":
			for i in range(2):
				yield(tcha.reTimer(0.1), "timeout")
				if tcha.aiCha == null:
					yield(tcha.reTimer(0.05), "timeout")
				tcha.castTorpedo()
#----------------------------------------------052闷棍----------------------------------------------
class Skill_052 extends Skill:
	func _init():
		._init()
		text = "<固化>每12秒使所有没被眩晕的敌人眩晕2秒，并延迟1秒技能冷却"
		sname = "闷棍"
		sid = 52
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("upS", tcha, "upS")
		makeConnect("onBattleStart", tcha, "onBattleStart")
	var flag = 0
	func upS():
		flag += 1
		if flag >= 12:
			for i in tcha.getAllChas(1):
				if not i.hasBuff("b_xuanYun"):
					i.addBuff(buff.b_xuanYun.new(2))
					for j in i.skills:
						j.nowTime -= 1
			flag = 0
	func onBattleStart():
		flag = 0
#----------------------------------------------053燃烧瓶----------------------------------------------
class Skill_053 extends Skill:
	func _init():
		._init()
		text = "每10秒赋予当前目标及其周围(九宫格)的所有敌人4层<灼烧><烧蚀>"
		sname = "燃烧瓶"
		sid = 53
		type = "dps"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("sk053", 10)
		cdId = "sk053"
	func castCdSkill(id):	
		if id == "sk053":
			for i in tcha.getAroundChas(tcha.aiCha.cell, false, tcha.aiCha):
				tcha.castBuff(i, buff.b_zhuoShao.new(4))
				tcha.castBuff(i, buff.b_shaoShi.new(4))
#----------------------------------------------054电磁脉冲----------------------------------------------
class Skill_054 extends Skill:
	func _init():
		._init()
		text = "战斗开始时，同行敌军50%概率失去一件装备"
		sname = "电磁脉冲"
		sid = 54
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleStart", tcha, "onBattleStart")
	func onBattleStart():
		for i in tcha.getAllChas(1):
			if i.cell.x == tcha.cell.x and not i.items.empty() and sys.rndPer(50):
				i.delItem(i.items[0])
#----------------------------------------------055光荣传统----------------------------------------------
class Skill_055 extends Skill:
	func _init():
		._init()
		text = "战斗开始时，获得10%增伤。10秒后将增伤传递给已造成伤害量最高的友军(可叠加)"
		sname = "光荣传统"
		sid = 55
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleStart", tcha, "onBattleStart")
		makeConnect("upS", tcha, "upS")
	var flag = 0
	func upS():
		flag += 1
		if flag >= 10:
			var bf = tcha.hasBuff("b_sk055")
			if bf != null:
				var cha = azurCtrl.getChaByDmg(1)
				cha.addBuff(b_sk055.new())
				bf.isDel = true
	func onBattleStart():
		flag = 0
		tcha.addBuff(b_sk055.new())
	class b_sk055:
		extends "../azurlane_ctrl/AzurBuff.gd"
		func _init():
			attInit()
			buffName = "光荣传统"
			id = "b_sk055"	
			dispel = 2
			att.atkR = 0.1
#----------------------------------------------056变革之风----------------------------------------------
class Skill_056 extends Skill:
	func _init():
		._init()
		text = "每12秒，赋予所有人5层<活力>，不分敌我"
		sname = "变革之风"
		sid = 56
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("sk056", 8)
		cdId = "sk056"
	func castCdSkill(id):
		if id == "sk056":
			for i in tcha.getAllChas(0):
				buff.addHuoLi(i, tcha, 5)
#----------------------------------------------057信号干扰----------------------------------------------
class Skill_057 extends Skill:
	func _init():
		._init()
		text = "敌方召唤召唤物时，对其施加3层眩晕/暴露"
		sname = "信号干扰"
		sid = 57
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCharaNewChara", sys.main, "onCharaNewChara")
	func onCharaNewChara(cha):
		if not is_instance_valid(cha) or cha.get("summoner") == null:return
		tcha.castBuff(cha.summoner, buff.b_xuanYun.new(3))
		buff.addBaoLu(cha.summoner, 3)
#----------------------------------------------058冥想----------------------------------------------
class Skill_058 extends Skill:
	func _init():
		._init()
		text = "战斗开始时，若没有装备任何一件装备，则获得50%冷却缩减"
		sname = "冥想"
		sid = 58
		type = "all"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleStart", tcha, "onBattleStart")
	func onBattleStart():
		if utils.inBattle(tcha) and tcha.items.empty():
			tcha.addBuff(buff.b_cd.new(5))
#----------------------------------------------059远距射击----------------------------------------------
class Skill_059 extends Skill:
	func _init():
		._init()
		text = "战斗开始时，射程+5"
		sname = "远距射击"
		sid = 59
		type = "ad"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onBattleStart", tcha, "onBattleStart")
		if cha.isSumm:
			onBattleStart()
	func onBattleStart():
		if utils.inBattle(tcha):
			tcha.addBuff(buff.b_atkRan.new(5, 0, 2))
#----------------------------------------------060重型航弹----------------------------------------------
class Skill_060 extends Skill:
	func _init():
		._init()
		text = "自身轰炸机的炮击伤害提高35%"
		sname = "重型航弹"
		sid = 60
		type = "air"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCharaNewChara", sys.main, "onCharaNewChara")
	func onCharaNewChara(cha):
		if is_instance_valid(cha) and cha.type == sys.CharaClass.CAS and cha.summoner == tcha:
			cha.addBuff(b_sk060.new())
	class b_sk060:
		extends "../azurlane_ctrl/AzurBuff.gd"
		func _init():
			attInit()
			id = "b_sk060"	
			dispel = 2
		func _connect():
			masCha.connect("onAtkChara",self,"_onAtkChara")
		func _onAtkChara(atkInfo):
			if atkInfo.atkType == sys.AtkType.GUN:
				atkInfo.hurtVal *= 1.35
#----------------------------------------------061雷达反制----------------------------------------------
class Skill_061 extends Skill:
	func _init():
		._init()
		text = "受到来自具有<致盲>状态的敌人造成的技能伤害时，35%概率闪避"
		sname = "雷达反制"
		sid = 61
		type = "t"
	func setCha(cha):
		.setCha(cha)
		makeConnect("onHurt", tcha, "onHurt")
	func onHurt(atkInfo):
		if atkInfo.atkType == sys.AtkType.SKILL and atkInfo.atkCha.hasBuff("b_zhiMang") != null and sys.rndPer(35):
			atkInfo.isMiss = true

#----------------------------------------------062天雷罪灭----------------------------------------------
class Skill_062 extends Skill:
	var p1 = 10
	func _init():
		._init()
		text = "每10秒审判罪孽最为深重之人(伤害最高的敌人)，对其造成[雷击*5]的技能伤害"
		sname = "天雷罪灭"
		sid = 62
		type = "dps"
		enableAi = false
	func setCha(cha):
		.setCha(cha)
		makeConnect("onCastCdSkill", tcha, "castCdSkill")
		tcha.addCdSkill("tianleizm", 10)
		cdId = "tianleizm"
	func castCdSkill(id):	
		if id == "tianleizm":
			tcha.summoner.tianleizm(null, false)